package com.wjk.kylin.modules.generator.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wjk.kylin.modules.generator.entity.GenTableColumn;
import com.wjk.kylin.modules.generator.mapper.GenTableColumnMapper;
import com.wjk.kylin.modules.generator.service.IGenTableColumnService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * <p>
 *  业务字段 服务实现类
 * </p>
 *
 * @author wangjkui
 * @since 2020-06-07
 */
@Service
@Transactional(readOnly=true)
public class GenTableColumnServiceImpl extends ServiceImpl<GenTableColumnMapper, GenTableColumn> implements IGenTableColumnService {

    @Override
    public List<GenTableColumn> findListByTableId(String tableId) {

        QueryWrapper<GenTableColumn> wrapper = new QueryWrapper<>();
        wrapper.eq("table_id",tableId);
        wrapper.orderByAsc("sort");

        return super.list(wrapper);
    }

    @Override
    public List<GenTableColumn> findDbTableColumnsByName(String tableName) {
        return baseMapper.findDbTableColumnsByName(tableName);
    }
}
